<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>个人中心</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css" />
      <link rel="stylesheet" type="text/css" href="../../css/common.css" />
      <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #fff;}
          .aui-active .aui-bar-tab-label{
            color: #f5a51c
          }
          .login {height:240px;background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);/*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/position: relative;}
      	.login .personal_logo {width: 4rem;height: 4rem;border-radius: 50%;margin: 0 auto 9px;/*position: absolute; top: 60px; left: 20px;*/}
      		.login .userinfo {position: absolute; top: 60px;text-align: center; left: 0; right: 0;}
      		.login .userinfo .title {font-size: 0.8rem; color: #fff;}

      		/* 设置条目 */
      		.item {height: 3rem;line-height: 3rem;padding-left: 0.7rem;background-color: #fff;}
      		.item_ico {float: left;width: 2.3rem;padding: 0.7rem 0.7rem 0.7rem 0;}
      		.item_arrow {float: right;width: 1.5rem;padding: 1rem 0.7rem 1rem 0;}
      		.item span {font-size: 0.7rem;}
          .circliMain{
            text-align: center;
          }

          [v-cloak] {
              display: none;
          }
          .aui-toast-content{
            color: #fff;
          }
      </style>
  </head>
  <body>
<div id="app" >
<div class="user_nav_line"></div>
  <div class="aui-refresh-content" >
    <div  :style="{display:isNone}" class="circliMain">
        <div class="payPassword_content">
          <img src="../../image/my/m26.png" alt="">
        </div>
        <div>很抱歉，您还不是商圈圈主</div>

      <button type="button" name="button" class="user_set_btn" @click="applyForStore" style="margin-left:0;border-radius:1rem;">申请成为商圈圈主</button>
  </div>
    <ul class="aui-list aui-media-list" :style="{display:isMsg}" v-for="value in allList">

       <li class="aui-list-item aui-list-item-middle">
           <div class="aui-media-list-item-inner">
               <div class="aui-list-item-media" style="width: 4rem;">
                   <img :src=value.logo class=" aui-list-img-sm">
               </div>
               <div class="aui-list-item-inner">
                   <div class="aui-list-item-text">
                       <div class="aui-list-item-title aui-font-size-14">{{value.name}}</div>

                   </div>
                   <div class="aui-list-item-text" style="font-size:0.6rem">
                       {{value.circle_time}}加入
                   </div>
                   <div class="aui-list-item-text">
                      {{value.province}}{{value.city}}{{value.district}}
                   </div>
               </div>
           </div>
       </li>
     </ul>
</div>

  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/zepto.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript" src="../../script/utils.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript" src="../../script/aui-tab.js"></script>
  <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  <script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
  <script type="text/javascript" src="../../script/aui-toast.js"></script>
  <script type="text/javascript">

    apiready = function(){
      var toast = new auiToast({});
      new Vue({
        el:'#app',
        data:{
            isNone:'none',
            isMsg:'none',
            allList:[],
            page:1,
            allPage:''
        },
        methods:{
          //申请商圈主
          applyForStore:function(){
            api.openWin({
                name: 'applyForStore',
                url: './headerone.html',
                pageParam:{
                  msg:'申请圈主',
                  url:'./applyForStore.html'
                }
            });

          },
          myStore:function(){
            var _this = this;
            api.ajax({
                url: window.Url.Freestore_myCircle,
                method: 'post',
                data: {
                    values: {
                        token:$api.getStorage('token'),
                        page:_this.page
                    }
                }
            },function(ret, err){
             //alert( JSON.stringify( ret) );
                if (ret.re==3) {
                    _this.isNone='block'
                } else if(ret.re==1){
                   _this.isMsg='block'
                    _this.allList = ret.data.list;
                    _this.allPage = ret.data.sum_page;
                }else{
                  toast.fail({
                    title:ret.info,
                    duration:1000
                  })
                }
            });

          },
          //刷新
          setRefresh:function() {
              var pullRefresh = new auiPullToRefresh({
                  container: document.querySelector('.aui-refresh-content'),
                  triggerDistance: 100
              }, function(ret) {

                  if (ret.status == "success") {
                      setTimeout(function() {
                          pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                      }, 1500)
                  }
              })
          }
        },
        mounted:function(){
          var $_this=this;
          //检测到达底部添加下一页内容
          var scroll = new auiScroll({
              listen:true, //是否监听滚动高度，开启后将实时返回滚动高度
              distance:40 //判断到达底部的距离，isToBottom为true
          },function(ret){
              if (ret.isToBottom) {
                  $_this.page ++
                  if ($_this.page > $_this.totalpage) {
                      $_this.page = $_this.totalpage
                      return
                  }
                  api.ajax({
                      url:window.Url.Freestore_myCircle,
                      method: 'post',
                      data: {
                          values: {
                            token:$api.getStorage('token'),
                            page:$_this.page
                          }
                      },
                      timeout: 300,
                  }, function(ret, err) {

                      if (ret.re==1) {
                          //  api.alert({ msg: JSON.stringify(ret) });
                          $_this.allList = $_this.allList.concat(ret.data.newsList)

                      } else {
                          toast.fail({
                            title:ret.info,
                            duration:1000
                          })
                      }
                  })
              }

          })

            this.setRefresh();
            this.myStore();
        }

      })
      };


  </script>
  </html>
